define(["jquery", "easy-admin"], function ($, ea) {
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'selution.selution/index',


        export_url: 'selution.selution/export',

        count_url: 'selution.selution/count_url',
        where_url: 'selution.selution/where_url',
        batch_url: 'selution.selution/batch_url',
        AI_url: 'selution.selution/AI_url',
        batch_change_url: 'selution.selution/batch_change_url',



    };



    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                height:750,
                toolbar: ['refresh',
                    [{
                        text: '统计导出',
                        url: init.export_url,
                        method: 'request',
                        auth: 'export',
                        class: 'layui-btn layui-btn-sm',
                        icon: 'fa fa-download ',
                        extend: 'data-url="' + init.export_url+ '"',

                    }],[{
                        text: '条件导出',
                        url: init.where_url,
                        method: 'open',
                        auth: 'export',
                        class: 'layui-btn layui-btn-sm',
                        icon: 'fa fa-download ',
                        extend: 'data-full="true"',
                    }],[{
                        text: '批量导出',
                        url: init.export_url,
                        method: 'open',
                        auth: 'export',
                        class: 'layui-btn layui-btn-sm',
                        icon: 'fa fa-download ',
                        extend: 'data-full="true"',
                    }], [{
                        text: 'AI时间导出',
                        url: init.AI_url,
                        method: 'open',
                        auth: 'export',
                        class: 'layui-btn layui-btn-sm',
                        icon: 'fa fa-download ',
                        extend: 'data-full="true"',
                    }], [{
                        text: '批量修改状态',
                        url: init.batch_change_url,
                        method: 'open',
                        auth: 'export',
                        class: 'layui-btn layui-btn-sm',
                        icon: 'fa fa-download ',
                        extend: 'data-full="true"',
                    }],

                    ],

                cols: [[


                //'AI图'=>'AIImg','color'=>'CustomColor ',
                //'刻字大图'=>'TextImg','刻字文字'=>'CustomText',
                //'生产预览图'=>'ProductPreviewImg','工厂生产图'=>'ProductImg',
                //'效果图'=>'EffectImg','原图'=>'SourceImg','字母图'=>'LetterImg',
                //'字母文字'=>'LetterAppend','备注'=>'Memo','刻字效果图'=>'TextEffectImg',

                    {type: 'checkbox'},
                    {field: 'AIImg', title: 'AI图',templet: ea.table.image,width: 100},
                    {field: 'color', title: '颜色',search:'batch'},
                    {field: 'sku', title: '货号',width: 100},
                    {field: 'TextEffectImg', title: '刻字效果图',templet: ea.table.image,width: 100},
                    {field: 'ai_author', title: '操作人',width: 90},

                    {field: 'status', title:'状态',width: 90},

                    {field: 'unique_code', title: '唯一码',width: 90},

                    {field: 'TextImg', title: '刻字大图',width: 100,templet: ea.table.image,},
                    {field: 'CustomText', title: '刻字文字',width: 100},
                    {field: 'ProductPreviewImg', title: '生产预览图',width: 110,templet: ea.table.image,},
                    {field: 'ProductImg', title: '工厂生产图',width: 100,templet: ea.table.image,},
                    {field: 'EffectImg', title: '效果图',width: 90,templet: ea.table.image,},
                    {field: 'SourceImg', title: '原图',templet: ea.table.image,width: 100},
                    {field: 'LetterImg', title: '字母图',width: 90,templet: ea.table.image,},
                    {field: 'LetterAppend', title: '字母文字',width: 100},
                    {field: 'Memo', title: '备注',},
                    {field: '', title: 'ERP留言',width: 100},
                    {field: '', title: '工厂异常原因',width: 120},
                    {field: 'supplier.name', title: '实际制作工厂',width: 120},



                ]],
                customDefaultToolbar:true,
                defaultToolbar: [
                    // {
                    //     title: '搜索',
                    //     layEvent: 'TABLE_SEARCH',
                    //     icon: 'layui-icon-search',
                    //     extend: 'data-table-id="' + init.table_render_id + '"'
                    // }
                ],

                filter: {
                    items:['column'],
                    cache: true,
                    bottom: false
                }, done: function (){
                    //穿透 回调 外面的this
                    layui.use(["soulTable"], soulTable => {
                        soulTable.render(this);
                    });
                }
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },

    };
    return Controller;
});